package com.amiu.autoMybatis.test.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.amiu.Bean;
import com.amiu.autoMybatis.annotation.Mapper;

@Mapper
public interface DaoMapper2 {
	@Select("SELECT * FROM test1 WHERE id = #{id}")
	public Bean findById(long id);
	
	@Select("SELECT * FROM test1 WHERE phone = #{phone}")
	public List<Bean> findByPhone(long phone);
	
	@MapKey("id")
	@Select("SELECT * FROM test1 WHERE name = #{name}")
	public Map<Long, Bean> findByName(String name);
	
	@Insert("insert into test1(id,name,password,phone) values(#{id},#{name},#{password},#{phone})")
	public int insert(Bean bean);
	
	public void deleteById(long id);
	@Update("UPDATE FROM test1 SET name=#{name},password=#{password},phone=#{phone} where id=#{id}")
	public void updateById(Bean bean);
}
